-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
58 lines (40 loc) · 1.23 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
using namespace std;
int main()
{
int aux;
double notas;
cin >> notas;
int n = notas;
int moedas = (notas - n) * 100;
if ((moedas * 1000) % 10 == 9)
{
moedas++;
}
cout << "NOTAS:" << endl;
cout << n / 100 << " nota(s) de R$ 100.00" << endl;
aux = (n % 100);
cout << aux / 50 << " nota(s) de R$ 50.00" << endl;
aux = (aux % 50);
cout << aux / 20 << " nota(s) de R$ 20.00" << endl;
aux = (aux % 20);
cout << aux / 10 << " nota(s) de R$ 10.00" << endl;
aux = (aux % 10);
cout << aux / 5 << " nota(s) de R$ 5.00" << endl;
aux = (aux % 5);
cout << aux / 2 << " nota(s) de R$ 2.00" << endl;
aux = (aux % 2);
cout << "MOEDAS:" << endl;
cout << aux << " moeda(s) de R$ 1.00" << endl;
moedas = (moedas % 100);
cout << moedas / 50 << " moeda(s) de R$ 0.50" << endl;
moedas = (moedas % 50);
cout << moedas / 25 << " moeda(s) de R$ 0.25" << endl;
moedas = (moedas % 25);
cout << moedas / 10 << " moeda(s) de R$ 0.10" << endl;
moedas = (moedas % 10);
cout << moedas / 5 << " moeda(s) de R$ 0.05" << endl;
moedas = (moedas % 5);
cout << moedas << " moeda(s) de R$ 0.01" << endl;
return 0;
}